from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from models import Section, Story

class SectionAdmin(admin.ModelAdmin):
	fieldsets = ((None, {'fields': ('site', 'name', 'slug', 'description',)}),)
	list_display = ('name', 'slug', 'site',)
	search_fields = ['name']
	ordering = ['name']
	prepopulated_fields = {'slug': ('name',)}
	
class StoryAdmin(admin.ModelAdmin):
	fieldsets = (
	    (None, {'fields': ('user', 'assoc_section', 'headline', 
			'slug', 'body',)}),
	    (_(u'Tagging'), {'fields': ('tags',),}),
	    (_(u'Date information'), {'fields': ('pub_date',), 
			'classes': 'collapse'}),
		(_(u'Attachments'), {'fields': ('lead_image',)}),
		(_(u'Settings'), {'fields': ('publication_status', 'enable_comments',)}),
	)
	list_display = ('headline', 'pub_date', 'user', 'assoc_section', 
		'enable_comments', 'publication_status',)
	list_filter = ('pub_date', 'user', 'assoc_section', 
		'enable_comments', 'publication_status',)
	search_fields = ['headline']
	date_hierarchy = 'pub_date'	
	prepopulated_fields = {'slug': ('headline',)}
	radio_fields = {'publication_status': True}
	
admin.site.register(Section, SectionAdmin)
admin.site.register(Story, StoryAdmin)